<?php
/**
 * Created by PhpStorm.
 * User: liang
 * Email:1050187159@qq.com
 * Date: 2018/8/18
 * Time: 22:50
 */
namespace Home\Controller;

class ProjectsController extends BaseController
{
    public function index()
    {
         $option_id = I('get.id');
         $Option = D('Option');
         $option = $Option->where(array(
             'id' => array('eq',$option_id),
             'is_show' => array('neq',0),
             'navigator_id' => array('eq',3)
         ))->find();
         if (empty($option)) {
             $this->_empty();
         }
         $option['description'] = htmlspecialchars_decode($option['description']);


         $Project = D('Project');
         $projects = $Project->where(array('is_show'=>array('eq',1)))->order('sort asc')->select();
         foreach ($projects as $key => $project) {
             $projects[$key]['content'] = msubstr(strip_tags(htmlspecialchars_decode($project['content'])), 0 , 80);
         }
         $this->assign(array(
             'nav' => $option,
             'projects' => $projects
         ));
         if ($this->isMobile()) {
             $this->display('mobile/Projects/town');
         } else {
             $this->display('web/Projects/town');
         }
    }

    public function detail()
    {

    }
}